<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5/themes/default/easyui.css"></link>
	<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5/themes/icon.css"></link>
	<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5/demo/demo.css"></link>
	<script language="JavaScript"  type="text/javascript" src="js/jquery-easyui-1.5/jquery.min.js"></script>
	<script language="JavaScript"  type="text/javascript" src="js/jquery-easyui-1.5/jquery.easyui.min.js"></script>
	
	<script type="text/javascript">
	
	function showUserList()
	{
		
		
		$.get("/List", function(data){
				$("#table").datagrid("loadData", data);
			});
	}
	
	 $(document).ready(  
			  function(){
				  
				  $('#dlg').dialog('close');
				  showUserList();
					   
			  });
	 
	    function deleteUser(val)
	    {
	    	$.messager.defaults= { ok: "确定",cancel: "取消" };
	    	 
	    	$.messager.confirm("操作提示","您确定要执行操作吗？",
	    		function (data)
	    	 	{
	    	            if (data)
	    	 			{
	    	            	var url = "delete_user?id="+val;
	    			    	$.get(url, function(data){
	    			    			showUserList();
	    					});
	    	            	 $.messager.alert("操作提示","删除成功！");
	    	            }
	    	            
	    	     });
	
	    }
	    
	 	function formatPrice(val,row){
				return '<a href="#"  onclick="deleteUser(\''+val+'\')">删除</a>'
			
		}
	</script>
	
	 
</head>
<body>

<div style="position:absolute;left:0px;top:0px">
<table id="table" class="easyui-datagrid" title="用户列表" style="width:700px;height:450px;"
			data-options="singleSelect:true,collapsible:false">
		<thead>
			<tr>
				<th data-options="field:'login_name',width:80">用户名</th>
				<th data-options="field:'login_id',width:100">用户ID</th>
				<th data-options="field:'login_pwd',width:80,align:'right'">密码</th>
				<th data-options="field:'role_id',width:100">角色</th>
				<th data-options="field:'id',width:200,align:'right',formatter:formatPrice">操作</th>

			</tr>
		</thead>
	</table>
	</div>
	
</body>
</html>